﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using HalconDotNet;//Halcon命名空间

namespace ShowPicture
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        HObject ho_Image, ho_GrayImage, ho_Regions;
        private void button1_Click(object sender, EventArgs e)
        {
            string ImagePath;

            openFileDialog1.Filter = "JPEG文件|*.jpg*|BMP文件|*.bmp*";
            openFileDialog1.RestoreDirectory = true;

            HOperatorSet.GenEmptyObj(out ho_Image);
            HOperatorSet.GenEmptyObj(out ho_GrayImage);
            HOperatorSet.GenEmptyObj(out ho_Regions);
            ho_Image.Dispose();
           
            if (openFileDialog1.ShowDialog()==DialogResult.OK)
            {
                ImagePath = openFileDialog1.FileName;
                HOperatorSet.ReadImage(out ho_Image, ImagePath);
            }
        }
    }
}
